var app = require('express')();
app.listen(3000, function(){
  console.log('express listening on *:3000');
});


var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
  res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
  console.log('connected')
  socket.on('chat message', function(msg){
    console.log('got msg ', msg)
    io.emit('chat message', msg);
  });
});

http.listen(3001, function(){
  console.log('socket listening on *:3001');
});
